package com.xizimall.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * 商品分类管理Controller
 * <p>Title: ItemCatController</p>
 * <p>Description: </p>
 * <p>华南理工大学研究生</p> 
 * @author	李隆熹
 * @date	2018年4月12日下午4:23:46
 * @version 1.0
 */
import org.springframework.web.bind.annotation.ResponseBody;

import com.xizimall.pojo.TbItemCat;
import com.xizimall.service.ItemCatService;
import com.xizimall.common.pojo.EUTreeNode;
@Controller
@RequestMapping("/item/cat")
public class ItemCatController {
    @Autowired
	private ItemCatService itemCatService;
    @RequestMapping("/list")
	@ResponseBody
	//如果id为null是使用默认值，也就是parentid为0的分类列表
	public List<EUTreeNode> getCatList(@RequestParam(value="id", defaultValue="0") Long parentId){
       List<EUTreeNode>list= itemCatService.getItemCatList(parentId);
    	return list;
    	
    }
}
